package com.free.ext.quartz.model;

import java.io.Serializable;

import org.apache.commons.lang3.StringUtils;


/**
 * <p>
 * 功能概述: 
 * </p>
 * <p>
 * 功能详述: 
 * </p>
 */
public class TaskRes implements Serializable
{

    /*========================================================================*
     *                         Public Fields (公共属性)                                                                
     *========================================================================*/

    /*========================================================================*
     *                         Private Fields (私有属性)                                                                
     *========================================================================*/
    
    /**
     * 
     */
    private static final long serialVersionUID = 9082004374166467596L;

    private String jobName;
    
    private String jobGroup;

    private String startTime;

    private String endTime;
    
    private Object data;
    
    private boolean success = true;

    /*========================================================================*
     *                         Construct Methods (构造方法) 
     *========================================================================*/

    /*========================================================================*
     *                         Public Methods (公有方法)                                                                   
     *========================================================================*/

    public static TaskRes success(String startTime, String endTime, Object data)
    {
        TaskRes res = new TaskRes();
        res.setStartTime(startTime);
        res.setEndTime(endTime);
        res.setData(data);
        return res;
    }
    
    public static TaskRes error(Object data)
    {
        return error(StringUtils.EMPTY,StringUtils.EMPTY,data);
    }
    
    public static TaskRes error(String groupNm, String taskNm,Object data)
    {
        return error(StringUtils.EMPTY,StringUtils.EMPTY,groupNm,taskNm,data);
    }
    
    public static TaskRes error(String startTime, String endTime, String groupNm, String taskNm, Object data)
    {
        TaskRes res = new TaskRes();
        res.setStartTime(startTime);
        res.setEndTime(endTime);
        res.setData(data);
        res.setSuccess(false);
        return res;
    }
    
    
    /**
     * @return the jobName
     */
    public String getJobName()
    {
        return jobName;
    }

    /**
     * @param jobName the jobName to set
     */
    public void setJobName(String jobName)
    {
        this.jobName = jobName;
    }

    /**
     * @return the jobGroup
     */
    public String getJobGroup()
    {
        return jobGroup;
    }

    /**
     * @param jobGroup the jobGroup to set
     */
    public void setJobGroup(String jobGroup)
    {
        this.jobGroup = jobGroup;
    }

    /**
     * @return the startTime
     */
    public String getStartTime()
    {
        return startTime;
    }
    /**
     * @param startTime the startTime to set
     */
    public void setStartTime(String startTime)
    {
        this.startTime = startTime;
    }
    /**
     * @return the endTime
     */
    public String getEndTime()
    {
        return endTime;
    }
    /**
     * @param endTime the endTime to set
     */
    public void setEndTime(String endTime)
    {
        this.endTime = endTime;
    }
   
    /**
     * @return the success
     */
    public boolean isSuccess()
    {
        return success;
    }

    /**
     * @param success the success to set
     */
    public void setSuccess(boolean success)
    {
        this.success = success;
    }

    /**
     * @return the data
     */
    public Object getData()
    {
        return data;
    }

    /**
     * @param data the data to set
     */
    public void setData(Object data)
    {
        this.data = data;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString()
    {
        return "TaskRes [jobName=" + jobName + ", jobGroup=" + jobGroup + ", startTime=" + startTime + ", endTime=" + endTime + ", data=" + data + ", success="
                + success + "]";
    }
 
    
    /*========================================================================*
     *                         Private Methods (私有方法)                                                                   
     *========================================================================*/
}

